/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package deatax;

/**
 *
 * @author Pieman
 */
public class TilePopulation {
    
    
    private int cpop;
    private boolean[] milestoneReached;
    private int cmile;

    public int getCurrentMilestone() {
        return cmile;
    }

    public void setCurrentMilestone(int currentMilestone) {
        this.cmile = currentMilestone;
    }

    public int getCurrentPopulation() {
        return cpop;
    }

    public void setCurrentPopulation(int currentPopulation) {
        this.cpop = currentPopulation;
    }
    
    public int addPopulation(int n, int m) {
        int before = cpop;
        cpop += n;
        if (cpop < 0) {
            cpop = 0;
        } else if (cpop > m) {
            cpop = m;
        }
        return cpop - before;
    }

}
